{namespace n=GeorgRinger\News\ViewHelpers}
{namespace ngoos=Ngoos\ViewHelpers}
<f:layout name="General"/>

<f:section name="content">
    <f:switch expression="{settings.templateLayout}">
        <f:case value="1">
            <div class="c-content-box c-size-md c-bg-grey-1">
                <div class="container">
                    <div class="row">
                        <div class="col-md-8 wow animate fadeInLeft">
                            <div class="c-content-media-2-slider" data-slider="owl" data-single-item="true" data-auto-play="4000">
                                <div class="c-content-label c-font-uppercase c-font-bold">Latest News</div>
                                <div class="owl-carousel owl-theme c-theme owl-single">
                                    <f:for each="{news}" as="newsItem" iteration="iterator">
                                        <f:if condition="{ngoos:getImgUrlFromContent(content:newsItem.bodytext)}">
                                            <div class="item">
                                                <n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
                                                    <div class="c-content-media-2 c-bg-img-center" style="background-image: url('<ngoos:getImgUrlFromContent content="{newsItem.bodytext}" width="750c" height="360c" />'); min-height: 360px;">
                                                        &nbsp;
                                                        <div class="c-panel">
                                                            <div class="c-fav">
                                                                <i class="icon-heart c-font-thin"></i>

                                                                <p class="c-font-thin"></p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </n:link>
                                            </div>
                                        </f:if>
                                </f:for>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4 wow animate fadeInRight">
                        <div class="c-content-media-1-slider" data-slider="owl" data-single-item="true" data-auto-play="8000">
                            <div class="owl-carousel owl-theme c-theme owl-single">
                                <f:if condition="{news}">
                                    <f:then>
                                        <f:for each="{news}" as="newsItem" iteration="iterator">
                                            <div class="item">
                                                <div class="c-content-media-1" style="min-height: 360px;">
                                                    <div class="c-content-label c-font-uppercase c-font-bold c-theme-bg">{newsItem.author}</div>
                                                    <n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}" class="c-title c-font-uppercase c-font-bold c-theme-on-hover">{newsItem.title}</n:link>
                                                    <p>
                                                        <f:if condition="{newsItem.teaser}">
                                                            <f:then>{newsItem.teaser -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'1') -> f:format.stripTags()}</f:then>
                                                            <f:else>{newsItem.bodytext -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'1') -> f:format.stripTags()}</f:else>
                                                        </f:if>
                                                    </p>
                                                    <div class="c-date">
                                                        <f:format.date format="{f:translate(key:'dateFormat')}">{newsItem.datetime}</f:format.date>
                                                    </div>
                                                </div>
                                            </div>
                                        </f:for>
                                    </f:then>
                                    <f:else>
                                        <div class="item">
                                            <f:translate key="list_nonewsfound"/>
                                        </div>
                                    </f:else>
                                </f:if>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </div>
        </f:case>
        <f:case value="2">
            <div class="c-content-title-1">
                <h3 class="c-font-uppercase c-font-bold c-font-white">官方通告</h3>

                <div class="c-line-left hide"></div>
            </div>
            <div class="c-blog">
                <f:for each="{news}" as="newsItem" iteration="iterator">
                    <div class="c-post">
                        <f:if condition="{ngoos:getImgUrlFromContent(content:newsItem.bodytext)}">
                            <div class="c-post-img">
                                <img src="{ngoos:getImgUrlFromContent(content:newsItem.bodytext)}" title="{newsItem.title}" alt="{newsItem.title}" class="img-responsive"/>
                            </div>
                        </f:if>
                        <div class="c-post-content">
                            <h4 class="c-post-title">
                                <n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
                                    {newsItem.title}
                                </n:link>
                            </h4>
                            <p class="c-text">
                                <f:if condition="{newsItem.teaser}">
                                    <f:then>{newsItem.teaser -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'1') -> f:format.stripTags()}</f:then>
                                    <f:else>{newsItem.bodytext -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'1') -> f:format.stripTags()}</f:else>
                                </f:if>
                            </p>
                        </div>
                    </div>
                </f:for>
            </div>
        </f:case>
        <f:case value="3">
            <div class="c-content-title-1">
                <h3 class="c-font-uppercase c-font-bold c-font-white">新闻动态</h3>

                <div class="c-line-left hide"></div>
            </div>
            <ul class="c-works">
                <f:for each="{news}" as="newsItem" iteration="iterator">
                    <li>
                        <f:if condition="{ngoos:getImgUrlFromContent(content:newsItem.bodytext)}">
                            <n:link newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
                                <img src="{ngoos:getImgUrlFromContent(content:newsItem.bodytext, width:'74c', height:'74c')}" title="{newsItem.title}" alt="{newsItem.title}" class="img-responsive"/>
                            </n:link>
                        </f:if>
                    </li>
                </f:for>
            </ul>
        </f:case>
        <f:case default="1">
            <div>
                <f:if condition="{news}">
                    <f:then>
                        <ul class="news-list-view list-unstyled">
                            <f:if condition="{settings.hidePagination}">
                                <f:then>
                                    <f:for each="{news}" as="newsItem" iteration="iterator">
                                        <f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}"/>
                                    </f:for>
                                </f:then>
                                <f:else>
                                    <n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
                                        <f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
                                            <f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}"/>
                                        </f:for>
                                    </n:widget.paginate>
                                </f:else>
                            </f:if>
                        </ul>
                    </f:then>
                    <f:else>
                        <div class="no-news-found">
                            <f:translate key="list_nonewsfound"/>
                        </div>
                    </f:else>
                </f:if>
            </div>
        </f:case>
    </f:switch>
</f:section>
